package com.test;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * <dl>
 * <dt>PropertiesUtil</dt>
 * <dd>Description:</dd>
 * <dd>Copyright: Copyright (C) 2006</dd>
 * <dd>CreateDate: 2019-3-7</dd>
 * </dl>
 *
 * @author Administrator
 */
public class PropertiesUtil {
    private static String suffix = ".properties";

    public static Properties getProperties(String name){
        Properties props = new Properties();
        InputStream in = PropertiesUtil.class.getClassLoader().getResourceAsStream(name + suffix);
        try {
            props.load(in);
        } catch (IOException e) {
            e.printStackTrace();
        }finally{
            if(null != in){
                try {
                    in.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return props;
    }
}
